home *** CD-ROM | disk | FTP | other *** search
- /*
- File: USBKeypadHeader.c
-
- Contains: xxx put contents here xxx
-
- Version: xxx put version here xxx
-
- Copyright: © 1999 by Apple Computer, Inc., all rights reserved.
-
- */
-
- #include <Types.h>
- #include <Devices.h>
- #include <DriverServices.h>
- #include <USB.h>
-
- #include "USBKeypad.h"
- #include "USBKeypadVersion.h"
-
- static OSStatus MacAllyTenKeyDeviceInitialize (USBDeviceRef device, USBDeviceDescriptorPtr pDesc, UInt32 busPowerAvailable);
- static OSStatus MacAllyTenKeyFinalize(USBDeviceRef device, USBDeviceDescriptorPtr pDesc);
- static OSStatus MacAllyTenKeyInterfaceInitialize (UInt32 interfacenum, USBInterfaceDescriptorPtr pInterface, USBDeviceDescriptorPtr pDesc, USBDeviceRef device);
- static OSStatus MacAllyTenKeyDriverValidateHW(USBDeviceRef device, USBDeviceDescriptor *desc);
-
- extern usbKeyPadPBStruct myParamBlock;
-
- //------------------------------------------------------
- //
- // This is the driver description structure that the expert looks for first.
- // If it's here, the information within is used to match the driver
- // to the device whose descriptor was passed to the expert.
- // Information in this block is also used by the expert when an
- // entry is created in the Name Registry.
- //
- //------------------------------------------------------
- USBDriverDescription TheUSBDriverDescription =
- {
- // Signature info
- kTheUSBDriverDescriptionSignature,
- kInitialUSBDriverDescriptor,
-
- // Device Info
- 0x0618, // vendor = not device specific
- 0x0300, // product = not device specific
- 0, // version of product = not device specific
- 0, // protocol = not device specific
-
- // Interface Info (* I don't think this would always be required...*)
- 0, // Configuration Value
- 0, // Interface Number
- 0, // Interface Class
- 0, // Interface SubClass
- 0, // Interface Protocol
-
-
- // Driver Info
- "\pUSBHIDMacAllyTenKey", // Driver name for Name Registry
- 0, // Device Class (from USBDeviceDefines.h)
- 0, // Device Subclass
- kKBDHexMajorVers,
- kKBDHexMinorVers,
- kKBDCurrentRelease,
- kKBDReleaseStage, // version of driver
-
- // Driver Loading Info
- kUSBProtocolMustMatch+kUSBDoNotMatchInterface+kUSBDoNotMatchGenericDevice // Flags (currently undefined)
- };
-
- USBClassDriverPluginDispatchTable TheClassDriverPluginDispatchTable =
- {
- kClassDriverPluginVersion, // Version of this structure
- MacAllyTenKeyDriverValidateHW, // Hardware Validation Procedure
- MacAllyTenKeyDeviceInitialize, // Initialization Procedure
- MacAllyTenKeyInterfaceInitialize, // Interface Initialization Procedure
- MacAllyTenKeyFinalize, // Finalization Procedure
- 0, // Driver Notification Procedure
- };
-
-
- // Initialization function
- // Called upon load by Expert
- static OSStatus MacAllyTenKeyDeviceInitialize (USBDeviceRef device, USBDeviceDescriptorPtr pDesc, UInt32 busPowerAvailable)
- {
- DriverEntry(device, pDesc, busPowerAvailable);
- return (OSStatus)noErr;
- }
-
- // Interface Initialization Initialization function
- // Called upon load by Expert
- static OSStatus MacAllyTenKeyInterfaceInitialize (UInt32 interfacenum, USBInterfaceDescriptorPtr pInterface, USBDeviceDescriptorPtr pDesc, USBDeviceRef device)
- {
- #pragma unused (pInterface)
- #pragma unused (pDesc)
- #pragma unused (device)
- #pragma unused (interfacenum)
- USBExpertStatus(device, "\pUSBHIDMacAllyTenKey: Entered via MacAllyTenKeyDeviceInitialize", device);
- return (OSStatus)noErr;
- }
-
-
-
- // Termination function
- // Called by Expert when driver is being shut down
- static OSStatus MacAllyTenKeyFinalize(USBDeviceRef theDeviceRef, USBDeviceDescriptorPtr pDesc)
- {
- #pragma unused (pDesc)
-
- OSStatus myErr;
-
- USBExpertStatus(theDeviceRef, "\pUSBHIDMacAllyTenKey: Finalize", theDeviceRef);
- if (myParamBlock.pFullConfigDescriptor != nil)
- {
- if (myParamBlock.pipeRef)
- {
- USBExpertStatus(theDeviceRef, "\pUSBHIDMacAllyTenKey: Aborting interrupt pipe", theDeviceRef);
- USBAbortPipeByReference(myParamBlock.pipeRef);
- }
-
- myParamBlock.pb.usbReference = theDeviceRef;
- myParamBlock.pb.pbVersion = kUSBCurrentPBVersion;
- myParamBlock.pb.usbFlags = 0;
- myParamBlock.pb.usbRefcon = 0;
- myParamBlock.pb.usbBuffer = myParamBlock.pFullConfigDescriptor;
- myParamBlock.pb.usbCompletion = (USBCompletion)-1;
-
- myErr = USBDeallocMem(&myParamBlock.pb);
- };
- return (OSStatus)noErr;
- }
-
- // Hardware Validation
- // Called upon load by Expert
- OSStatus MacAllyTenKeyDriverValidateHW(USBDeviceRef device, USBDeviceDescriptor *desc)
- {
- #pragma unused (device)
- #pragma unused (desc)
-
- return (OSStatus)kUSBNoErr;
- }
-
-